#include "service.h"
#include "http-config.h"
void start_web_server() {
    unsigned short port = std::stoi(configReader.getConfig(CONFIG_DASHBOARD_PORT, "7749"));
    std::string addr = configReader.getConfig(CONFIG_DASHBOARD_LISTEN,"127.0.0.1");
    std::cout << "Starting HTTP service at " <<  addr << ":" << port << std::endl;
    regRoute();
    defineMime();
    try {
        create_service(addr.c_str(), port, http_accept_thread);
    } catch(const int err) {
        std::cout << "HTTP service start failed: " + std::string(strerror(err)) << std::endl;
        throw err;
    }
    
}